#!/usr/bin/python3
# -*- coding: utf-8 -*-

from sqlalchemy import (
    MetaData, Table, Column, ForeignKey,
    Integer, String, Date
)

meta = MetaData()

Question = Table(
    'Question', meta,

    Column('id', Integer, primary_key=True),
    Column('question_text', String(200), nullable=False),
    Column('pub_date', Date, nullable=False)
)

Choice = Table(
    'Choice', meta,

    Column('id', Integer, primary_key=True),
    Column('choice_text', String(200), nullable=False),
    Column('votes', Integer, server_default="0", nullable=False),
    Column('question_id',
           Integer,
           ForeignKey('question.id', ondelete='CASCADE'))
)
